#include "esp_log.h"
#include "driver/gpio.h"
#include "E:\Espressif\frameworks\esp-idf-v5.0\components\esp_rom\include\esp32s3\rom\ets_sys.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

/*cs1237 REF 输出开关:默认 REF 输出开启*/
#define REF_OUT_ON 0b0
#define REF_OUT_OFF 0b1
/*cs1237相应配置参数*/
#define SPEED_10Hz 0b00
#define SPEED_40Hz 0b01
#define SPEED_640Hz 0b10
#define SPEED_1280Hz 0b11
/*cs1237 PGA 选择:默认 PGA 为 128，在测温模式下 PGA_SEL=00*/
#define PGA_1X 0b00
#define PGA_2X 0b01
#define PGA_64X 0b10
#define PGA_128X 0b11
/*cs1237 通道选择:默认通道为通道 A*/
#define CH_SEL_A 0b00
#define CH_SEL_CCORESAVE 0b01
#define CH_SEL_TEMP 0b10
#define CH_SEL_SC 0b11

/*_cs1237结构体属性*/
typedef struct cs1237
{
    /*io 宏定义*/
    uint8_t dio; /*数据线*/
    uint8_t clk; /*时钟线*/
} _cs1237;

void cs1237_config(_cs1237 *cs1237_dat, uint8_t speed, uint8_t channel, uint8_t pga, uint8_t refout); /*cs1237 初始化配置*/
int32_t cs1237_read(_cs1237 *cs1237_dat);                                                             /*cs1237 读取数据*/
